﻿@using Model;
@{
    Layout = "~/Shared/_SiteLayout.cshtml";
    Page.Title = "Question Details";

    int i = 0;

    int questionId = UrlData[0].AsInt();// Request.Form["Id"].AsInt();

    Question aQuestion = null;

    List<QOption> selectedOption = null;

    QuestionType aQuestionType = null;

    if (!IsPost)
    {
        aQuestion = SiteHelper.GetAQuestionById(questionId);
        if (aQuestion != null)
        {
            selectedOption = SiteHelper.GetQOptionListByQuestionId(aQuestion.Id);

            aQuestionType = SiteHelper.GetQuestionTypeById(aQuestion.QTId);

            if (string.IsNullOrEmpty(aQuestion.AnswerStatus))
            {
                //questions.Remove(item);

                aQuestion.AnswerStatus = SiteHelper.GetStatus(aQuestion.IsAnswered);
            }
        }
    }
}
<form method="post" action="">
<fieldset>
    <legend>Question Details</legend>
    @if (aQuestion != null)
    {
        <div class="display">
            <div class="divwrapper" style="width: 50%; float: left;">
                <div>
                    <label>
                        Question:
                    </label>
                    <span class="question">@aQuestion.Questions</span>
                </div>
                <hr />
                <div>
                    <ul>
                        @for (i = 0; i < selectedOption.Count; i++)
                        {
                            int optionId = i + 1;
                            <li>
                                <label>
                                    Option @optionId :
                                </label>
                                <span class="question-option">@selectedOption[i].Options</span>
                                @if (@selectedOption[i].IsAnswer == true)
                                {
                                    <text> (</text> <span class="RightAnswered">Answer</span> <text> )</text>
                                }
                            </li>
                        }
                    </ul>
                </div>
                <hr />
                <div>
                    <a class="button thin gray" href='javascript:history.back();'>Back</a>
                </div>
            </div>
            <div class="divwrapper question-info" style="width: 48%; float: right;">
                <div>
                    <label>
                        Question for Class:</label>
                    @aQuestion.ReadingClass
                </div>
                <hr />
                <div>
                    <label>
                        Question Create Date:</label>
                    @aQuestion.CreateDate
                </div>
                <hr />
                <div>
                    <label>
                        Question Answer Date:</label>
                    @aQuestion.CreateDate
                </div>
                <hr />
                <div>
                    <label>
                        Total Answering Time:</label>
                    @aQuestion.TotalAnsweringTime seconds
                </div>
                <hr />
                <div>
                    <label>
                        Spending Time:</label>
                    @aQuestion.SpendingTime second(s)
                </div>
                <hr />
                <div>
                    <label>
                        Answer Status:</label>
                    <span class="AnswerStatus" id="AnswerStatus">
                        @aQuestion.AnswerStatus
                    </span>
                </div>
                <hr />
                <div>
                    <label>
                        Question Type:</label>
                    @aQuestionType.QType
                </div>
            </div>
        </div>
    }
    else
    {
        <p class="message error">
            No Question Found
        </p>}
</fieldset>
</form>
<script src="@Href("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"></script>
<script src="@Href("~/Scripts/Answer-table-color.js")" type="text/javascript"></script>